package io.openmessaging;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class 子集 {


    private void adapter(int[] nums,LinkedList trace,int head,List<List<Integer>> result){
        if(!result.contains(trace)){
            result.add(new ArrayList(trace));
        }
        for(int i=head;i<nums.length;i++){
            if(trace.contains(nums[i])){
                continue;
            }
            trace.addLast(nums[i]);
            head=i+1;
            adapter(nums,trace,head,result);
            head=head-1;
            trace.removeLast();
        }
    }




    public static void main(String[] args) {
        int[] nums=new int[]{1,2,3};
        List<List<Integer>> result=new ArrayList<>();
        子集 s=new 子集();
        s.adapter(nums,new LinkedList(),0,result);
        System.out.println(result);
    }
}
